Skip to content

fix/hyprland scrolling focus v2 - #1468

Open
justindotdevv wants to merge 4 commits into
vicinaehq:mainfrom
justindotdevv:fix/hyprland-scrolling-focus-v2
Open

fix/hyprland scrolling focus v2#1468
justindotdevv wants to merge 4 commits into
vicinaehq:mainfrom
justindotdevv:fix/hyprland-scrolling-focus-v2

Conversation

@justindotdevv

@justindotdevv justindotdevv commented Jun 1, 2026

Copy link
Copy Markdown

Fixes #1329

On Hyprland with the scrolling layout, the window switcher did not focus the target window or scroll the viewport.

Changes:

  • Defer focusWindowSync with QTimer::singleShot(0, ...) so it runs after the launcher hides.
  • Force OnDemand keyboard interactivity on Hyprland to allow clean focus handoff.
  • Remove dead eval API calls and add layoutmsg center to scroll the viewport.

Tested on Hyprland 0.55.2 with scrolling layout.

Note

Difference from v1 (PR #1330): The original PR attempted to fix this by adding a deferUntilWindowHidden() mechanism to NavigationController, detecting the scrolling layout at runtime, and polling Hyprland until the window reported as focused before sending layoutmsg center. It did not address the exclusive keyboard interactivity issue and still failed. This PR takes a much simpler approach: force OnDemand interactivity on Hyprland (regardless of closeOnFocusLoss), defer focusWindowSync directly in FocusWindowAction with QTimer::singleShot(0, ...), and send focuswindow + layoutmsg center atomically in a single [[BATCH]] — no polling, no layout detection, no NavigationController changes, and no refactor of unrelated systems.

AI assistance: Developed with OpenCode (Kimi k2.6). All changes were reviewed and tested locally.

On Hyprland, exclusive keyboard interactivity on the layer-shell surface

blocks the compositor from cleanly handing off focus to the target window.

Force OnDemand interactivity on Hyprland regardless of the closeOnFocusLoss

setting, while preserving the existing behavior on other compositors.

Refs: vicinaehq#1329
On Hyprland, focusWindowSync was called synchronously during action

execution, before the launcher had actually hidden. The layer-shell

surface was still holding keyboard focus, causing the focus command

to be silently dropped.

Defer focusWindowSync to the next event loop iteration using

QTimer::singleShot(0, ...), guaranteeing it runs after hide() completes.

Remove the dead eval hl.dispatch(...) line from focusWindowSync and

closeWindow. Hyprland 0.55.2 does not support eval with the non-Lua

config manager.

Add dispatch layoutmsg center to focusWindowSync to explicitly instruct

the scrolling layout to scroll the viewport to the focused window.

Refs: vicinaehq#1329
@justindotdevv
justindotdevv force-pushed the fix/hyprland-scrolling-focus-v2 branch from 402779d to 7d3b3f5 Compare June 1, 2026 08:45
@justindotdevv
justindotdevv marked this pull request as ready for review June 1, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window switcher doesn't scroll viewport to focused window on Hyprland scrolling layou

1 participant